<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of rbferr</title>
  <meta name="keywords" content="rbferr">
  <meta name="description" content="RBFERR	Evaluate error function for RBF network.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../menu.html">Home</a> &gt;  <a href="#">ReBEL-0.2.7</a> &gt; <a href="#">netlab</a> &gt; rbferr.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../menu.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="menu.html">Index for .\ReBEL-0.2.7\netlab&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>rbferr
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>RBFERR	Evaluate error function for RBF network.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function [e, edata, eprior] = rbferr(net, x, t) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment">RBFERR    Evaluate error function for RBF network.

    Description
    E = RBFERR(NET, X, T) takes a network data structure NET together
    with a matrix X of input vectors and a matrix T of target vectors,
    and evaluates the appropriate error function E depending on
    NET.OUTFN.  Each row of X corresponds to one input vector and each
    row of T contains the corresponding target vector.

    [E, EDATA, EPRIOR] = RBFERR(NET, X, T) additionally returns the data
    and prior components of the error, assuming a zero mean Gaussian
    prior on the weights with inverse variance parameters ALPHA and BETA
    taken from the network data structure NET.

    See also
    <a href="rbf.html" class="code" title="function net = rbf(nin, nhidden, nout, rbfunc, outfunc, prior, beta)">RBF</a>, <a href="rbffwd.html" class="code" title="function [a, z, n2] = rbffwd(net, x)">RBFFWD</a>, <a href="rbfgrad.html" class="code" title="function [g, gdata, gprior] = rbfgrad(net, x, t)">RBFGRAD</a>, <a href="rbfpak.html" class="code" title="function w = rbfpak(net)">RBFPAK</a>, <a href="rbftrain.html" class="code" title="function [net, options] = rbftrain(net, options, x, t)">RBFTRAIN</a>, <a href="rbfunpak.html" class="code" title="function net = rbfunpak(net, w)">RBFUNPAK</a></pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="consist.html" class="code" title="function errstring = consist(model, type, inputs, outputs)">consist</a>	CONSIST Check that arguments are consistent.</li><li><a href="dist2.html" class="code" title="function n2 = dist2(x, c)">dist2</a>	DIST2	Calculates squared distance between two sets of points.</li><li><a href="errbayes.html" class="code" title="function [e, edata, eprior] = errbayes(net, edata)">errbayes</a>	ERRBAYES Evaluate Bayesian error function for network.</li><li><a href="rbffwd.html" class="code" title="function [a, z, n2] = rbffwd(net, x)">rbffwd</a>	RBFFWD	Forward propagation through RBF network with linear outputs.</li></ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="demrbf1.html" class="code" title="">demrbf1</a>	DEMRBF1 Demonstrate simple regression using a radial basis function network.</li></ul>
<!-- crossreference -->


<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [e, edata, eprior] = rbferr(net, x, t)</a>
0002 <span class="comment">%RBFERR    Evaluate error function for RBF network.</span>
0003 <span class="comment">%</span>
0004 <span class="comment">%    Description</span>
0005 <span class="comment">%    E = RBFERR(NET, X, T) takes a network data structure NET together</span>
0006 <span class="comment">%    with a matrix X of input vectors and a matrix T of target vectors,</span>
0007 <span class="comment">%    and evaluates the appropriate error function E depending on</span>
0008 <span class="comment">%    NET.OUTFN.  Each row of X corresponds to one input vector and each</span>
0009 <span class="comment">%    row of T contains the corresponding target vector.</span>
0010 <span class="comment">%</span>
0011 <span class="comment">%    [E, EDATA, EPRIOR] = RBFERR(NET, X, T) additionally returns the data</span>
0012 <span class="comment">%    and prior components of the error, assuming a zero mean Gaussian</span>
0013 <span class="comment">%    prior on the weights with inverse variance parameters ALPHA and BETA</span>
0014 <span class="comment">%    taken from the network data structure NET.</span>
0015 <span class="comment">%</span>
0016 <span class="comment">%    See also</span>
0017 <span class="comment">%    RBF, RBFFWD, RBFGRAD, RBFPAK, RBFTRAIN, RBFUNPAK</span>
0018 <span class="comment">%</span>
0019 
0020 <span class="comment">%    Copyright (c) Ian T Nabney (1996-2001)</span>
0021 
0022 <span class="comment">% Check arguments for consistency</span>
0023 <span class="keyword">switch</span> net.outfn
0024 <span class="keyword">case</span> <span class="string">'linear'</span>
0025    errstring = <a href="consist.html" class="code" title="function errstring = consist(model, type, inputs, outputs)">consist</a>(net, <span class="string">'rbf'</span>, x, t);
0026 <span class="keyword">case</span> <span class="string">'neuroscale'</span>
0027    errstring = <a href="consist.html" class="code" title="function errstring = consist(model, type, inputs, outputs)">consist</a>(net, <span class="string">'rbf'</span>, x);
0028 <span class="keyword">otherwise</span>
0029    error([<span class="string">'Unknown output function '</span>, net.outfn]);
0030 <span class="keyword">end</span>
0031 <span class="keyword">if</span> ~isempty(errstring);
0032   error(errstring);
0033 <span class="keyword">end</span>
0034 
0035 <span class="keyword">switch</span> net.outfn
0036 <span class="keyword">case</span> <span class="string">'linear'</span>
0037    y = <a href="rbffwd.html" class="code" title="function [a, z, n2] = rbffwd(net, x)">rbffwd</a>(net, x);
0038    edata = 0.5*sum(sum((y - t).^2));
0039 <span class="keyword">case</span> <span class="string">'neuroscale'</span>
0040    y = <a href="rbffwd.html" class="code" title="function [a, z, n2] = rbffwd(net, x)">rbffwd</a>(net, x);
0041    y_dist = sqrt(<a href="dist2.html" class="code" title="function n2 = dist2(x, c)">dist2</a>(y, y));
0042    <span class="comment">% Take t as target distance matrix</span>
0043    edata = 0.5.*(sum(sum((t-y_dist).^2)));
0044 <span class="keyword">otherwise</span>
0045    error([<span class="string">'Unknown output function '</span>, net.outfn]);
0046 <span class="keyword">end</span>
0047 
0048 <span class="comment">% Compute Bayesian regularised error</span>
0049 [e, edata, eprior] = <a href="errbayes.html" class="code" title="function [e, edata, eprior] = errbayes(net, edata)">errbayes</a>(net, edata);
0050</pre></div>
<hr><address>Generated on Tue 26-Sep-2006 10:36:21 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>